package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysVipRulesMapper;
import com.ruoyi.system.domain.SysVipRules;
import com.ruoyi.system.service.ISysVipRulesService;

/**
 * 会员规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-11
 */
@Service
public class SysVipRulesServiceImpl implements ISysVipRulesService 
{
    @Autowired
    private SysVipRulesMapper sysVipRulesMapper;

    /**
     * 查询会员规则
     * 
     * @param ruleId 会员规则主键
     * @return 会员规则
     */
    @Override
    public SysVipRules selectSysVipRulesByRuleId(Long ruleId)
    {
        return sysVipRulesMapper.selectSysVipRulesByRuleId(ruleId);
    }

    /**
     * 查询会员规则列表
     * 
     * @param sysVipRules 会员规则
     * @return 会员规则
     */
    @Override
    public List<SysVipRules> selectSysVipRulesList(SysVipRules sysVipRules)
    {
        return sysVipRulesMapper.selectSysVipRulesList(sysVipRules);
    }

    /**
     * 新增会员规则
     * 
     * @param sysVipRules 会员规则
     * @return 结果
     */
    @Override
    public int insertSysVipRules(SysVipRules sysVipRules)
    {
        return sysVipRulesMapper.insertSysVipRules(sysVipRules);
    }

    /**
     * 修改会员规则
     * 
     * @param sysVipRules 会员规则
     * @return 结果
     */
    @Override
    public int updateSysVipRules(SysVipRules sysVipRules)
    {
        return sysVipRulesMapper.updateSysVipRules(sysVipRules);
    }

    /**
     * 批量删除会员规则
     * 
     * @param ruleIds 需要删除的会员规则主键
     * @return 结果
     */
    @Override
    public int deleteSysVipRulesByRuleIds(Long[] ruleIds)
    {
        return sysVipRulesMapper.deleteSysVipRulesByRuleIds(ruleIds);
    }

    /**
     * 删除会员规则信息
     * 
     * @param ruleId 会员规则主键
     * @return 结果
     */
    @Override
    public int deleteSysVipRulesByRuleId(Long ruleId)
    {
        return sysVipRulesMapper.deleteSysVipRulesByRuleId(ruleId);
    }
    /**
     * 获取最新的vip规则
     *
     * @return 结果
     */
    public List<SysVipRules> selectVipRulesLeast(String ownerid) {
        return sysVipRulesMapper.selectVipRulesLeast(ownerid);
    }
}
